<?php

class ActionControllerDynamicPage extends AbstarctActionControllerPage 
{
    var $action;
    
    function ActionControllerDynamicPage($newPage, $newAction)
    {
        $this->page = $newPage;
        $this->action = $newAction;
    }
    
    function execute()
    {
        ob_start();
        $this->pageLifeCycle($this->page, $this->action);
        ob_end_flush();        
    }
    
    function pageLifeCycle($clase, $action)
    {
        $$clase = new $clase;
        
        if (empty($action))
        {
            $$clase->init();            
        }
        elseif (method_exists($$clase, $action))
        {
            $$clase->$action();    
        }
        else
        {
            Error::InvalidAction($action);
        }  
        
    }   
}
?>
